import java.util.*;
public class TestClass {
    private static void testMethod(){
        System.out.println("testMethod");
    }

    public static void main(String[] args) {
        Stack<Integer> stack=new Stack<>();
        String[] tokens={"2","1","+","3","*"};
        for(String token : tokens){
            char s=token.charAt(0);
            if(token.length() == 1 && token.charAt(0) <'0' || token.charAt(0) >'9'){
                stack.push(Integer.valueOf(token));
            }
            else if(s=='+'){
                stack.push(stack.pop()+stack.pop());
            }
            else if(s=='-'){
                stack.push(-stack.pop()+stack.pop());
            }
            else if(s=='*'){
                stack.push(stack.pop()*stack.pop());
            }
            else if(s=='/'){
                int num1=stack.pop();
                int num2=stack.pop();
                stack.push(num2/num1);
            }
        }
        System.out.println(stack.pop());
    }
    public static void main1(String[] args) throws java.io.IOException {
//        ((TestClass)null).testMethod();
        try {

            // do something that may cause an Exception

        } catch (java.lang.Exception ex) {

            System.out.print("Exception!");

        }
    }
}